﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using AutoMapper;
using DTO;

namespace DAO
{
    public class LapBaoCaoNam_DAO
    {
        public BindingList<LapBaoCaoNam_DTO> GetBaoCaoNamList(int Nam)
        {
            BindingList<LapBaoCaoNam_DTO> list = new BindingList<LapBaoCaoNam_DTO>();
            try
            {
                QLCBDataContext context = new QLCBDataContext();
                var query = from cb in context.ChuyenBays
                            join tb in context.TuyenBays on cb.MaTuyenBay equals tb.MaTuyenBay
                            select new
                            {
                                cb.MaChuyenBay,
                                tb.MaTuyenBay,
                                tb.SanBayDi,
                                tb.SanBayDen,
                                cb.ThoiGianBay,
                                cb.Ngay_Gio,
                            };
                int mSTT = 1;
                foreach (var nl in query)
                {
                    LapBaoCaoNam_DTO DTO = new LapBaoCaoNam_DTO();
                    DTO.STT = mSTT;
                    list.Add(DTO);
                    mSTT++;
                }
            }
            catch (System.Exception ex)
            {
                string str = ex.Message;
            }
            return list;
        }
    }
}
